export default {
    template: `
    <div>
        <label for="username">用户名</label>
        <input type="text" name="username" v-model="username" placeholder="用户名">
        <label for="password">密码</label>
        <input type="password" name="password" v-model="password" placeholder="密码">
        <button @click="handleSubmit">登录</button>
        <button @click="handleUserInfo">获取用户的信息</button>
    </div>
    `,
    data: function () {
        return {
            username: '',
            password:''
        }
    },
    methods: {
        handleSubmit() {
            console.log(1);
            axios.post("/login", {
                username: this.username,
                password:this.password
            }).then(res => {
                if (res.data.code === 66) {
                    this.$router.push("home")
                }
                
            })
        },
        handleUserInfo() {
            console.log(2);
        }
    }
}